<%@ page import="weaver.conn.RecordSet" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="weaver.hrm.HrmUserVarify" %>
<%@ page import="weaver.hrm.User" %>
<%@ page language="java" pageEncoding="UTF-8" %>

<%
    String url="";
    try {
        User user = HrmUserVarify.getUser(request, response);
        String lastname=user.getLastname();
        String uid = user.getUID() + "";
        String requestid = Util.null2String(request.getParameter("requestid"));
        url = "/spa/workflow/static4form/index.html?#/main/workflow/req?requestid=" + requestid;
        RecordSet rs = new RecordSet();
        rs.execute("select GROUP_CONCAT(OPERATOR) OPERATOR,GROUP_CONCAT(RECEIVEDPERSONS) RECEIVEDPERSONS from workflow_requestlog where requestid ='" + requestid + "'");
        if (rs.next()) {
            String operator = Util.null2String(rs.getString("OPERATOR"));
            String RECEIVEDPERSONS = Util.null2String(rs.getString("RECEIVEDPERSONS"));
            String[] operatorArr = operator.split(",");
            String[] RECEIVEDPERSONSArr = RECEIVEDPERSONS.split(",");
            for (String s : operatorArr) {
                if (uid.equals(s)) {
                    url = "/spa/workflow/static4form/index.html?#/main/workflow/req?requestid=" + requestid;
                }
            }
            for (String s : RECEIVEDPERSONSArr) {
                if (lastname.equals(s)) {
                    url = "/spa/workflow/static4form/index.html?#/main/workflow/req?requestid=" + requestid;
                }
            }
        }
    }catch (Exception e){
        out.print(e);
    }
%>
<script>
    window.location.href ="<%=url%>";
</script>